import {defineStore} from "pinia";
import axios from "@/utils/NetWork.js";

const managerStore = defineStore("managerStore", {
    state:()=>{
        return {
            entry:[],
            type:'all'
        }
    },
    getters:{
        data:state=>state.entry.filter(entry=>state.type==='all'||entry.type===state.type)
    },
    actions:{
        getEntry(){
            return axios.post("/manager/entry",{})
                .then((res)=>res.data)
                .then(res=> {
                    this.entry = res
                    return res
                })
        }
    }
})

export default managerStore;